# -*- coding: utf-8 -*-

from autoscrapy.plugin import goose_plugin as goose
from autoscrapy.utils import log

LOG = log.get_logging(__name__)

class extract(object):

    def __init__(self, context):
        self._context = context
        self._plugin = goose.get_extract()

    def get_all_links(self, dom):
        url = []
        try:
            url = self._plugin.get_all_links(dom)
        except:
            # skip this except
            LOG.error("get all links fail for dom %s", dom)
        return url

    def extract_main_content(self, dom):
        content = None
        try:
            content = self._plugin.get_main_content(dom)
        except:
            LOG.error("extract main content fail for dom %s", dom)
        return content
